package com.tarry.shop.goods.entity;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.List;

import com.tarry.shop.validation.Delete;
import com.tarry.shop.validation.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 
 * </p>
 *
 * @author TARRY
 * @since 2021-11-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_goods")
@ApiModel(value="Goods对象", description="商品信息")
public class Goods extends Model<Goods> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "商品id")
    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(message = "ID不能为空",groups = {Update.class, Delete.class})
    private Integer id;

    @ApiModelProperty(value = "商品名称")
    private String goodsName;

    @ApiModelProperty(value = "商品价格")
    @NotNull(message = "商品价格不能为空",groups = {Update.class, Delete.class})
    private BigDecimal price;

    @ApiModelProperty(value = "商品种类")
    private Integer goodsType;

    @ApiModelProperty(value = "商品描述")
    private String goodsDesc;

    @ApiModelProperty(value = "商品图片")
    @TableField(exist = false)
    private List<GoodsImage> images;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
